#pragma once
/**
 * @author LIU YUAN
 * @date FEB 19, 2013 11:12:21 AM
 * @param <T>
 */
#include "stdafx.h"
#include <api/immdev.h>

#define CS_INPUTSTAR			(CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS)
#define MAX_PRIVATEDATA			100

typedef struct tagIMEMODULE{
	tagIMEMODULE *next;
	HMODULE module;
	HKL hkl;
}IMEMODULE,*PIMEMODULE;

typedef struct tagKEYINFO{
	DWORD uKey;
	BOOL  isProcess;
}KEYINFO,*PKEYINFO;

#define GETKEYINFO(lpIMC) (PKEYINFO)((DWORD)lpIMC + sizeof(INPUTCONTEXT));

BOOL ImeClass_Register(HINSTANCE hInstance);
void ImeClass_Unregister(HINSTANCE hInstance);

LRESULT WINAPI UIWndProc(HWND hWnd,	UINT message,WPARAM wParam,	LPARAM lParam);

BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo,LPTSTR lpszUIClass,LPCTSTR lpszOption);
BOOL WINAPI ImeProcessKey(HIMC hIMC,UINT uKey,LPARAM lKeyData,CONST LPBYTE lpbKeyState);
UINT WINAPI ImeToAsciiEx (UINT uVKey,UINT uScanCode,CONST LPBYTE lpbKeyState,LPDWORD lpdwTransKey,UINT fuState,HIMC hIMC);
BOOL WINAPI ClearCompStr(LPINPUTCONTEXT lpIMC);
BOOL CustomGenerateMessage(HIMC hIMC, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL MyGenerateMessageToTransKey(LPDWORD lpdwTransKey,
								 UINT *uNumTranMsgs,
								 UINT msg, 
								 WPARAM wParam, 
								 LPARAM lParam);

typedef BOOL (WINAPI *PnfImmFreeLayout)(HKL hkl);
BOOL WINAPI ImmFreeLayout(HKL hkl);